package com.hemj.fileInfo.controller;

import com.hemj.common.core.domain.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import com.github.pagehelper.Page;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hemj.common.annotation.Log;
import com.hemj.common.core.controller.BaseController;
import com.hemj.common.core.domain.AjaxResult;
import com.hemj.common.enums.BusinessType;
import com.hemj.fileInfo.domain.FileInfoLog;
import com.hemj.fileInfo.vo.FileInfoLogVo;
import com.hemj.fileInfo.bo.FileInfoLogBo;
import com.hemj.fileInfo.service.impl.FileInfoLogServiceImpl;
import com.hemj.common.utils.poi.ExcelUtil;
import com.hemj.common.core.page.TableDataInfo;

/**
 * 文件日志Controller
 * 
 * @author hemj
 * @date 2024-10-21
 */
@Api(tags = "文件日志接口")
@RestController
@RequestMapping("/fileInfo/fileInfoLog")
public class FileInfoLogController extends BaseController
{
    @Autowired
    private FileInfoLogServiceImpl fileInfoLogService;

    /**
     * 分页查询文件日志
     */
    //@PreAuthorize("@ss.hasPermi('fileInfo:fileInfoLog:list')")
    @PostMapping("/list")
    @ApiOperation("分页查询文件日志")
    public R<List<FileInfoLogBo>> list(@RequestBody FileInfoLogVo fileInfoLog)
    {
        Page page = startPage();
        List<FileInfoLogBo> list = fileInfoLogService.queryList(fileInfoLog);
        return getResDataTable(list,page);
    }

    /**
     * 查询文件日志列表
     */
    //@PreAuthorize("@ss.hasPermi('fileInfo:fileInfoLog:list')")
    @PostMapping("/query")
    @ApiOperation("查询文件日志列表")
    public R<List<FileInfoLogBo>> query(@RequestBody FileInfoLogVo fileInfoLog)
    {
        List<FileInfoLogBo> list = fileInfoLogService.queryList(fileInfoLog);
        return getResDataTable(list);
    }

    /**
     * 导出文件日志
     */
    //@PreAuthorize("@ss.hasPermi('fileInfo:fileInfoLog:export')")
    @Log(title = "文件日志", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    //@ApiOperation("导出文件日志")
    public void export(HttpServletResponse response, FileInfoLogVo fileInfoLog)
    {
        List<FileInfoLogBo> list = fileInfoLogService.queryList(fileInfoLog);
        ExcelUtil<FileInfoLogBo> util = new ExcelUtil<FileInfoLogBo>(FileInfoLogBo.class);
        util.exportExcel(response, list, "文件日志数据");
    }

    /**
     * 获取文件日志详细信息
     *//*
    //@PreAuthorize("@ss.hasPermi('fileInfo:fileInfoLog:query')")
    @PostMapping(value = "/get")
    @ApiOperation("获取文件日志详细信息")
    public R<FileInfoLogBo> getInfo(@RequestBody FileInfoLogVo fileInfoLog)
    {
        return R.ok(fileInfoLogService.getOneById(fileInfoLog.getId()));
    }

    *//**
     * 新增文件日志
     *//*
    //@PreAuthorize("@ss.hasPermi('fileInfo:fileInfoLog:add')")
    @Log(title = "文件日志", businessType = BusinessType.INSERT)
    @PostMapping(value = "/add")
    @ApiOperation("新增文件日志")
    public R add(@RequestBody FileInfoLogVo fileInfoLog)
    {
        fileInfoLog.setCreateBy(getNickName());
        fileInfoLog.setCreateTime(new Date());
        return R.ok(fileInfoLogService.saveCascade(fileInfoLog));
    }

    *//**
     * 修改文件日志
     *//*
    //@PreAuthorize("@ss.hasPermi('fileInfo:fileInfoLog:edit')")
    @Log(title = "文件日志", businessType = BusinessType.UPDATE)
    @PostMapping(value = "/update")
    @ApiOperation("修改增文件日志")
    public R edit(@RequestBody FileInfoLogVo fileInfoLog)
    {
        fileInfoLog.setUpdateBy(getNickName());
        fileInfoLog.setUpdateTime(new Date());
        return R.ok(fileInfoLogService.updateCascade(fileInfoLog));
    }

    *//**
     * 删除文件日志
     *//*
    //@PreAuthorize("@ss.hasPermi('fileInfo:fileInfoLog:remove')")
    @Log(title = "文件日志", businessType = BusinessType.DELETE)
	@PostMapping("/delete/{ids}")
    @ApiOperation("删除文件日志")
    public R remove(@PathVariable Long[] ids)
    {
        return toAjaxRes(fileInfoLogService.removeByIds(Arrays.asList(ids)));
    }*/
}
